using System.Collections.Generic;
using System.Linq;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using HengTong.Model.Db;
using HengTong.Model.Db.Hr;


namespace HengTong.ViewModel.Person.SysPersonProfessionalTitleTypeVms
{
    public partial class SysPersonProfessionalTitleTypeListVm : BasePagedListVM<SysPersonProfessionalTitleTypeView, SysPersonProfessionalTitleTypeSearcher>
    {

        protected override IEnumerable<IGridColumn<SysPersonProfessionalTitleTypeView>> InitGridHeader()
        {
            return new List<GridColumn<SysPersonProfessionalTitleTypeView>>{
                this.MakeGridHeader(x => x.CategoryCode),
                this.MakeGridHeader(x => x.CategoryName),
                this.MakeGridHeader(x => x.SortOrder),
                this.MakeGridHeader(x => x.Remark),
                this.MakeGridHeaderAction(width: 200)
            };
        }

        public override IOrderedQueryable<SysPersonProfessionalTitleTypeView> GetSearchQuery()
        {
            var query = DC.Set<SysPersonProfessionalTitleType>()
                .CheckContain(Searcher.CategoryCode, x=>x.CategoryCode)
                .CheckContain(Searcher.CategoryName, x=>x.CategoryName)
                .CheckEqual(Searcher.SortOrder, x=>x.SortOrder)
                .CheckContain(Searcher.Remark, x=>x.Remark)
                .Select(x => new SysPersonProfessionalTitleTypeView
                {
				    ID = x.ID,
                    CategoryCode = x.CategoryCode,
                    CategoryName = x.CategoryName,
                    SortOrder = x.SortOrder,
                    Remark = x.Remark,
                })
                .OrderBy(x => x.ID);
            return query;
        }

    }

    public class SysPersonProfessionalTitleTypeView : SysPersonProfessionalTitleType{

    }
}
